<%@page import="java.util.ArrayList"%>
<%@page import="com.docman.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.docman.domainmodel.*;" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>DocMan Anasayfa</title>
<link rel="stylesheet" type="text/css" href="style.css" />

<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">

jQuery(function()
{
	jQuery("#username").validate(
            {
                expression: "if ( VAL && isNaN(VAL) ) return true; else return false;",
                message: " <span style=\"color:red\">Kullanıcı adı geçersiz.</span>"
            });
	jQuery("#firstname").validate(
            {
                expression: "if (VAL) return true; else return false;",
                message: " <span style=\"color:red\">Bir isim giriniz.</span>"
            });
	
	jQuery("#lastname").validate(
            {
                expression: "if (VAL) return true; else return false;",
                message: " <span style=\"color:red\">Bir soyisim giriniz.</span>"
            });
	jQuery("#email").validate({
	    expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/) && VAL) return true; else return false;",
	    message: "<span style=\"color:red\">Gecerli bir mail adresi giriniz.</span>"
	});

	jQuery("#password1").validate(
            {
                expression: "if (VAL) return true; else return false;",
                message: " <span style=\"color:red\">Bir sifre giriniz.</span>"
            });
	
	jQuery("#password2").validate(
            {
                expression: "if ( VAL && VAL === jQuery('#password1').val())   return true; else return false;",
                message: " <span style=\"color:red\">Sifreler uyuşmuyor!</span>"
            });
	
	jQuery("#question").validate(
            {
                expression: "if (VAL) return true; else return false;",
                message: " <span style=\"color:red\">Bir guvenlik sorusu giriniz.</span>"
            });
	jQuery("#answer").validate(
            {
                expression: "if (VAL) return true; else return false;",
                message: " <span style=\"color:red\">Bir cevap giriniz.</span>"
            });
	
	
});


</script>


</head>
<body>

<div id="main_container">
	<div id="header">
			<div class="logo"><a href="index.jsp"><img src="img/top.png" border="0" alt="" title="" /></a></div>       
	</div>
        <div class="menu">
        	<ul>                                                                         
        		<li><a href="index.jsp">Anasayfa</a></li>
                <li><a href="profileServletpath">Profil</a></li>
                <li><a href="getTagServletpath?sId=0">Dosya Yükleme</a></li>
                <li><a href="getTagServletpath?sId=1">Ayrıntılı arama</a></li>
                <li><a href="contract.jsp">İletişim</a></li>
                <li class="selected"><a href="getUniandDeptServletpath">Kaydol</a></li>
        	</ul>
        </div>
        
    <div class="center_content">
    	<% ArrayList<UniversityBean> university = (ArrayList<UniversityBean>)(request.getAttribute("uniList"));
    	   ArrayList<DepartmentBean> department = (ArrayList<DepartmentBean>)(request.getAttribute("departmentList"));
    	   String errorMsg = (String)request.getAttribute("error"); %>
        <% if(errorMsg != null){ %>
        <ul>
        	<li><h3 style="color: red"><%= errorMsg %></h3></li>
        </ul>
         <% } %>
        <form action="registerServletpath" method="post">
        	
        	<table>
        		<tr>
        			<td><p style="font-size:1.5em">Kullanıcı Adı:</p></td>
        			<td><input type="text" name="username" size="25" id="username"/></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em">Adınız:</p></td>
        			<td><input type="text" name="firstname" size="25" id="firstname"/></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em">Soyadınız:</p></td>
        			<td><input type="text" name="lastname" size="25" id="lastname"/></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em">Mail Adresiniz:</p></td>
        			<td><input type="text" name="email" size="25" id="email"/></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em ">Şifre:</p></td>
        			<td><input type="password" name="password1" size="25" id="password1"/></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em ">Şifre Tekrarı:</p></td>
        			<td><input type="password" name="password2" size="25" id="password2"/></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em ">Gizli Soru:</p></td>
        			<td><input type="text" name="question" size="25" id="question"/></td>
        			<td><p style="font-size:1.5em ">Cevap:</p></td>
        			<td><input type="text" name="answer" size="25" id="answer"/></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em ">Üniversite:</p></td>
        			<td><select name="university">
        				<% for(int i = 0; i < university.size(); i++){ %>
        				<option value="<%=university.get(i).getUniversityName() %>"><%=university.get(i).getUniversityName() %></option>
        				<% } %>
        			</select></td>
        		</tr>
        		<tr>
        			<td><p style="font-size:1.5em ">Bölüm:</p></td>
        			<td><select name="department">
        				<% for(int i = 0; i < department.size(); i++){ %>
        				<option value="<%=department.get(i).getDepartmentName() %>"><%=department.get(i).getDepartmentName() %></option>
        				<% } %>
        			</select></td>
        		</tr>
        		<tr>
        			<td colspan="3"><center><input type ="submit" class="button" value="Kaydol" style="width:10em;" /></center></td>
        		</tr>
        	</table>
        
        </form>          

    </div>
         
</div>

</body>
</html>